package com.itheima.collection;

import java.util.ArrayList;
import java.util.Collection;
import java.util.function.Predicate;

/*
Collection的常用方法
 */
public class Demo01 {

    public static void main(String[] args) {
        //多态形式创建Collection接口的子类对象
        Collection<String> list= new ArrayList<>();

        list.add("鹿晗");
        list.add("关晓彤");
        list.add("张艺兴");
        list.add("黄子韬");
        list.add("蔡徐坤");
        System.out.println(list);
       /* list.removeIf(new Predicate<String>() {
            @Override
            public boolean test(String s) {
                return true;
            }
        });*/
       list.removeIf(s-> s.length()==2);

        System.out.println(list);
    }
}
